package org.gis.utils.beanloader;

import org.gis.mapserver.base.ConfigBean;
import org.gis.dbtools.UniqueID;
import org.gis.utils.dps.XmlBeanLoader;

/**
 *
 * @author gus
 */
public class SimpleConfigBeanLoader extends ConfigBeanLoader
{

    @Override
    protected ConfigBean loadBean( UniqueID uid ) throws Exception
    {
        String result = configBeanDAO.getXmlConfiguration(uid.toString());
        ConfigBean bean =  (ConfigBean) XmlBeanLoader.deserialize(result, ConfigBean.class);
        if(bean == null)
        {
            throw new Exception("can not found bean for " + uid);
        }
        bean.setUid(uid);
        bean.afterInitialize();
        return bean;
    }

}
